SPExport\SPImport Including single item security
Hello,
I want to export a single Item (SPListItem) or a file (Any object that inharits ISecurableObject) and export these objects with their security settings (the permissions on the item), but event though I set the parameter for security, the export cab contains to data on Permissions (although all the users and modifiers appeare), and so does the imported item.

This is what I write:

SPSite site = new SPSite("http://shp1/sites/MorSource/FeelingGood2");
SPWeb web = site.OpenWeb();

SPExport export = new SPExport();
export.Settings.OverwriteExistingDataFile = true;
export.Settings.CommandLineVerbose = true;
export.Settings.AutoGenerateDataFileName = true;
export.Settings.ExportMethod = SPExportMethodType.ExportAll;
export.Settings.SiteUrl = "http://shp1/sites/MorSource/FeelingGood2";
export.Settings.BaseFileName = "C:\\Exports\\export.cab";
export.Settings.IncludeSecurity = SPIncludeSecurity.All;
export.Settings.IncludeVersions = SPIncludeVersions.All;
export.Settings.ExportObjects.Add(new SPExportObject(
web.GetFile("http://shp1/sites/MorSource/FeelingGood2/Wiki/Mor.aspx").UniqueId,
SPDeploymentObjectType.ListItem,
web.GetList("http://shp1/sites/MorSource/FeelingGood2/Wiki").ID, SPIncludeDescendants.All));
export.Run();

When looking at the permissions on an item, you don't see it under the url of the file\item but under the url of the web, and I suspect that means that the export process does not consider the security as hierarchicaly under the item.

Please confirm my opinions or contradict me,
Thank you,
Mor.
April 28th, 2008 2:55pm

Hi,

I'm not clear from your post what's the problem? I have used the SPExport/SPImport for the same reason and it's working fine. Would you please explain your problem a bit elaborately?

Thanks

Sohel Rana

Free Windows Admin Tool Kit Click here and download it now
April 30th, 2008 1:55pm

I have a file (or item) that have unique role inheritance, but when I export\import them with the export Class everything is being exported\imported but the permissions (read write permissions), from what I could tell inside the exported cab file, there is no permissions data on the file (there is only user information, and who modified\created the file..)
April 30th, 2008 2:06pm

Hi,

Are data of the item being imported with the user information? Once I had faced with a problem that only the user information was being imported without any data and the exported file was small in size (around 3KB whereas it should be 3MB). If you are only getting the user information without any site data (say list items) then the problem may be with that you are not running your codeusing administrator's credential. Run the code with the windows user who is the Farm level administrator. As I know the Farm level administrator is the user who has installed the SharePoint in the server.

Thanks

Sohel Rana

Free Windows Admin Tool Kit Click here and download it now
April 30th, 2008 5:40pm

I'm expoting a single item and all the data\metada is being tranffered appropriately

export.Settings.ExportObjects.Add(new SPExportObject(
web.GetFile("http://shp1/sites/MorSource/FeelingGood2/Wiki/Mor.aspx").UniqueId,
SPDeploymentObjectType.ListItem,
web.GetList("http://shp1/sites/MorSource/FeelingGood2/Wiki").ID, SPIncludeDescendants.All));

In this example the file and the metadata are being imported ok, but the security on that file is not imported.
April 30th, 2008 6:09pm

Can you show your import code?

Are you setting IncludeSecurity=true on the SPImportSettings object?

Free Windows Admin Tool Kit Click here and download it now
May 1st, 2008 7:07pm

SPImport import = new SPImport();
import.Settings.SiteUrl = site.Url;
import.Settings.BaseFileName = folder + "\\" + fileName;
import.Settings.UpdateVersions = SPUpdateVersions.Append);
import.Settings.IgnoreWebParts = false;
import.Settings.UserInfoDateTime = SPImportUserInfoDateTimeOption.ImportAll;
import.Settings.WebUrl = web.Url;
import.Settings.CommandLineVerbose = true;
import.Settings.LogFilePath = logPath;
import.Run();

But again, I looked in the export file (opened it as a cab) and manually scanned the xml files inside, and there were no security data available.

Thank you.
May 11th, 2008 11:49am

Any chance you've managed to export its security data?

Free Windows Admin Tool Kit Click here and download it now
October 29th, 2013 5:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics